package com.yhy.tradesystem;

import java.util.ArrayList;

import com.yhy.tradesystem.util.Log;

public class EmptyFilter implements TradeSystemFilter {

	ArrayList<TradeSystemFilter> outputFilter = new ArrayList<TradeSystemFilter>();
	
	TradeDataPak outputPak;
	
	public String TAG="EmptyFilter";
	@Override
	public void connectOutput(TradeSystemFilter filter) {
		outputFilter.add(filter);
	}

	@Override
	public void inputData(TradeDataPak data) {
		outputPak = data;
		Log.d(TAG, "==============================");
		Log.d(TAG, data.stockData.date.toGMTString());
		Log.d(TAG, "开盘价 %f 收盘价 %f 最高 %f 最低 %f 成交量 %d",
				data.stockData.open,
				data.stockData.close,
				data.stockData.high,
				data.stockData.low,
				data.stockData.vol
				);
		
		
		if(data.techDataList!=null){
			for(TradeDataPak.TechnicalAnalysisData taData:data.techDataList){
				Log.d(TAG, "技术指标 %s ", taData.name);
				for(int i=0;i<taData.parameterNames.length;i++){
					Log.d(TAG, "参数 %s  数值 %f ", taData.parameterNames[i],taData.parameters[i]);
				}
				for(int i=0;i<taData.dataNames.length;i++){
					Log.d(TAG, "指标 %s  数值 %f ", taData.dataNames[i],taData.data[i]);
				}
			}
		}
		
		Log.d(TAG, "==============================");
		outputData();
	}

	@Override
	public TradeDataPak outputData() {
		for(TradeSystemFilter filter:outputFilter){
			filter.inputData(outputPak);
		}
		return outputPak;
	}

	@Override
	public String getName() {
		return EmptyFilter.class.getName();
	}

	@Override
	public void resetData() {
		
	}

}
